
local killed = achievements.GetValue( "Traitor", "total", 0 )

local function PlayerKilledNPC( msg )
	local victim, inflictor, attacker = msg:ReadString(), msg:ReadString(), msg:ReadEntity()
	
	if ( killed != 200 && attacker == LocalPlayer() && victim == "npc_citizen" ) then
		killed = math.Clamp( killed + 1, 0, 200 )
		achievements.SetValue( "Traitor", "total", killed )
		achievements.Update( "Traitor", killed / 200, killed .. "/200" )
	end		
	
	return victim, inflictor, attacker
end
usermessage.AddHook( "PlayerKilledNPC", "Achievements.Traitor", PlayerKilledNPC )

achievements.Register( "Traitor", "Kill 200 citizens/medics/rebels/refugees.", "achievements/traitor", killed / 200, killed .. "/200" )